package com.example.fragment;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class FourFragment extends Fragment{
	private Button fourok;
	private Button fourback;
	private ListView lv;
	private ArrayList<HashMap<String,String>> ar;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view=inflater.inflate(R.layout.fragment_fourth, container, false);
		fourok=(Button)view.findViewById(R.id.buttonfourok);
		fourback=(Button)view.findViewById(R.id.buttonfourback);
		lv=(ListView)view.findViewById(R.id.listViewfour);
		
		//选择默认城市
		fourok.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				
			}
		});
		
		//返回上一级
		fourback.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				
			}
		});
		
		// 设置在条目上单击监听器
		lv.setOnItemClickListener(itemListener);
		
		// 显示所有数据  
		showData();
		
	
		
		
		
		return view;
	}
	 
	OnItemClickListener itemListener = new OnItemClickListener()
	{  
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3)
		{
			// TODO Auto-generated method stub
			
		}  
	}; 
	
	private void showData()
	{
		/*
		//生成动态数组，加入数据
		ar = new ArrayList<HashMap<String,String>>();
		HashMap<String,String> map1 = new HashMap<String,String>();
		map1.put("name", "xiaoh");
		ar.add(map1);
		SimpleAdapter adapter = new SimpleAdapter(
				.this,ar,R.layout.fourlistview,
				new String[]{"name","phone"},
				new int[]{R.id.textViewfour,});
	
		//添加并且显示
		lv.setAdapter(adapter);
		*/
	}
}
